<?php
/**
 * Created by JetBrains PhpStorm.
 * User: user
 * Date: 3/16/12
 * Time: 5:46 PM
 * To change this template use File | Settings | File Templates.
 */
class Front_Model_Product extends Zend_Db_Table{

    //protected $_name = 'san_pham';
    public function getProduct(){
        echo '<br>' .  __CLASS__ . ' - ' .__FUNCTION__;
    }

    public function listitem($id){
        $db = Zend_Registry::get('connectDB');
        $select = $db->select()
                    ->from('san_pham AS sp')
                    ->where('sp.ma_loai = '.$id);
        $results = $db->fetchAll($select);
        return $results;
    }
    public function view($id){
        $db = Zend_Registry::get('connectDB');
        $select= $db->select()
                    ->from('san_pham AS sp')
                    ->where('sp.ma = '.$id);
        $results = $db->fetchAll($select);
        return $results;
    }
    public function sanphamdacbiet(){
    	$db = Zend_Registry::get('connectDB');
    	$select= $db->select()
    	->from('san_pham AS sp')
    	->where('sp.special = 1');
    	$results = $db->fetchAll($select);
    	return $results;
    }
    public function sanphammoira(){
    	$db = Zend_Registry::get('connectDB');
    	$select= $db->select()
    	->from('san_pham AS sp')
    	->where('sp.san_pham_moi = 1');
    	$results = $db->fetchAll($select);
    	return $results;
    }
}
 
